<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="exporter-version" content=mNote Mac 2.4.10"/><meta name="created" content="2013-07-29T14:19:37Z"/><meta name="updated" content="2013-07-29T14:19:37Z"/><title>Raspberry Pi(树莓派)的GPIO接口控制步进电机</title></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><td style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 21px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 6202px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; vertical-align: middle; width: 757px; word-wrap: break-word;">
<i style="border: 0px none rgb(153, 153, 153); color: rgb(153, 153, 153); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 32px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 32px; margin: 0px 0px -30px; outline: rgb(153, 153, 153) none 0px; padding: 0px; text-align: center; text-decoration: initial; width: 757px; word-wrap: break-word;"> 本帖最后由 xinxincaijq 于 2012-12-31 10:54 编辑 </i><br>
<br>
Raspberry Pi是什么？<br>
引用维基百科的一句话：<br>
<br>
The Raspberry Pi is a credit card sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools.<br>
简单地说，它就是一个基于ARM CPU的、信用卡那么大的迷你计算机。<br>
In short, Pi is an ARM-based mini computer which has a credit card size.<br>
<br>
在阅读本文之前，请确保你已经阅读过我的另外几篇关于Pi的文章，因为本文与它们有或多或少的关系。<br>
Before reading this article, please make sure that you've read some other articles of mine on Pi, because this article is more or less based on them.<br>
<br>
【1】实验目的 / Experiment purpose<br>
在树莓派上编写一个C程序，通过其GPIO口控制步进电机的转动方向以及速度。<br>
Write a C program to control the direction &amp; speed of rotation of a stepper motor through the GPIO on Raspberry Pi.<br>
<br>
【2】为什么要用树莓派来控制步进电机 / Why doing this<br>
在我的概念中，无论是控制接在树莓派上的摄像头来拍照，还是通过树莓派控制LED发光，我都还是在“虚拟世界”中折腾树莓派，因为它没有向外界输出任何动作。而在构建一个稍微复杂的系统时，这种能力可能是很重要的，于是，用树莓派来控制步进电机是我必须要做的事情。<br>
In my view, no matter using Pi to control webcam, or using Pi to light LED, the Raspberry Pi was in a "virtual" world all the time because it didn't output any movement to the real world. Having this ability may be very important to build a slightly more complex system, so I decided to use Pi to control a stepper motor.<br>
<br>
【3】实现方案 / The implementation<br>
怎样通过Raspberry Pi的GPIO口来控制步进电机？已经有很多人这样做了，例如Youtube上的这个例子。<br>
How to control a stepper motor through the GPIO on Pi? Lots of people have tried that before, such as this example on Youtube.<br>
由于步进电机通常需要一块驱动板，而这样的产品已经很容易买到并且极其廉价（肯定比你自己做要便宜），因此，我们没有必要自己去做。我在淘宝上不断地查啊查，终于找到了白菜价的步进电机和配套驱动板，加起来才一共8块多钱。<br>
Because we need a driver circuit board to drive the stepper motor, and it's really easy to buy this kind of product with super low price nowadays, so it's no need to make it ourselves. I searched taobao.com(the largest e-commerce website in China) and found a super cheap stepper motor &amp; it's matched driver board, they cost me only about 8 RMB, that is, less than $1.5!<br>
<br>
下面来看看我买的步进电机和驱动板的样子：<br>
The stepper motor &amp; it's driver board:<br>
<br>
<br>
步进电机和驱动板的接线：<br>
Connect the stepper motor with it's driver board:<br>
<br>
<br>
该驱动板配有一个原理图，根据它我们可以知道如何把整个系统连接起来：<br>
The driver board has a schematic diagram and we can learn from it how to connect the whole system together:<br>
<br>
<br>
可见，驱动板上有4个输入口：IN1~IN4，这4个口用来接树莓派的4个GPIO口。同时，我们需要为驱动板提供5V的供电，这从哪里来？当然是从树莓派引出来。从下面的GPIO口分布图可以得知，“2”口就是+5V，正好就利用它。<br>
We can see that there are total 4 input pins: IN1~IN4, these 4 pins will be connected to 4 GPIO pins on Raspberry Pi. And we also need to provide a 5V power supply to the board, so where can we get this? Use the pin "2"(5V) next to pin "1"(3.3V) on Pi is the most convenient way. Refer to following GPIO pinouts for details:<br>
<br>
<br>
我将树莓派上的GPIO 17、18、21、22口（用树莓派的命名方式就是0、1、2、3口）分别接到步进电机驱动板上的IN1、IN2、IN3、IN4口，最后接好线的效果如下：<br>
I connected GPIO 17, 18, 21, 22(namely GPIO 0, 1, 2, 3 in Raspberry Pi name) on Pi to IN1, IN2, IN3, IN4 on the driver board separately, after it's done, the whole system looks like this:<br>
<br>
<br>
【4】编写程序 / Write the program<br>
在参考了这款步进电机配套的51单片机的示例代码后，我知道了依次把驱动板的IN1~IN4置为高电平，就可以驱动步进电机，也就是说，要把树莓派的4个GPIO输出口依次置为高电平。例如，假设用0代表低电平，1代表高电平的话，GPIO 17、18、21、22口的电平第一次被置为1、0、0、0，第二次被置为0、1、0、0，第三次被置为0、0、1、0，第四次被置为0、0、0、1。<br>
After checking the code(for MCS51 singlechip) provided by the product dealer I knew that it's possible to drive the motor by set IN1~IN4 high level in turn, namely set the 4 GPIO pins high level in turn. For example, if we use 0 to represent low level and 1 to represent high level, then GPIO 17, 18, 21, 22 on Raspberry Pi will be set to 1,0,0,0 in the 1st round, 0,1,0,0 in the 2nd round, 0,0,1,0 in the 3rd round and 0,0,0,1 in the 4th round.<br>
<br>
于是我写出了下面的代码（仍然使用WiringPi这个库来操作GPIO）：<br>
So I wrote the follow code(still use WiringPi to manipulate the GPIO):<div style="background-image: url(http://www.eeboard.com/bbs/static/image/common/codebg.gif); background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(247, 247, 247); background-size: auto; border: 1px solid rgb(204, 204, 204); color: rgb(102, 102, 102); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 21px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 1782px; margin: 10px 0px; outline: rgb(102, 102, 102) none 0px; overflow: hidden; padding: 10px 0px 5px 10px; text-decoration: initial; width: 745px; word-wrap: break-word; background-position: 0px 0px; background-repeat: no-repeat repeat;"><div style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 21px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 1764px; margin: 0px; outline: rgb(102, 102, 102) none 0px; padding: 0px; text-decoration: initial; width: 745px; word-wrap: break-word;"><ol style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 21px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 1764px; margin: 0px 0px 0px 10px; outline: rgb(102, 102, 102) none 0px; padding: 0px; text-decoration: initial; width: 735px; word-wrap: break-word; list-style: decimal outside none;"><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">/* moto.c<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">* A program to control a stepper motor through the GPIO on Raspberry Pi. <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">* <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">* Author: Darran Zhang <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*/<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#include &lt;wiringPi.h&gt;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#include &lt;stdio.h&gt;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#include &lt;unistd.h&gt;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#include &lt;stdlib.h&gt;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#define CLOCKWISE 1<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#define COUNTER_CLOCKWISE 2<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void delayMS(int x);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void rotate(int* pins, int direction);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">int main(int argc,char* argv[]) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;if (argc &lt; 4) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; printf("Usage example: ./motor 0 1 2 3 \n");<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; return 1;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;/* number of the pins which connected to the stepper motor driver board */<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pinA = atoi(argv[1]);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pinB = atoi(argv[2]);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pinC = atoi(argv[3]);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pinD = atoi(argv[4]);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pins[4] = {pinA, pinB, pinC, pinD};<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;if (-1 == wiringPiSetup()) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; printf("Setup wiringPi failed!");<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; return 1;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;/* set mode to output */<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;pinMode(pinA, OUTPUT);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;pinMode(pinB, OUTPUT);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;pinMode(pinC, OUTPUT);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;pinMode(pinD, OUTPUT);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;delayMS(50);&nbsp; &nbsp; // wait for a stable status <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;for (int i = 0; i &lt; 500; i++) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; rotate(pins, CLOCKWISE);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;return 0;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">/* Suspend execution for x milliseconds intervals.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*&nbsp;&nbsp;@param ms Milliseconds to sleep.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*/<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void delayMS(int x) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;usleep(x * 1000);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">/* Rotate the motor.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*&nbsp;&nbsp;@param pins&nbsp; &nbsp;&nbsp;&nbsp;A pointer which points to the pins number array.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 42px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*&nbsp;&nbsp;@param direction&nbsp;&nbsp;CLOCKWISE for clockwise rotation, COUNTER_CLOCKWISE for counter clockwise rotation.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*/<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void rotate(int* pins, int direction) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;for (int i = 0; i &lt; 4; i++) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; if (CLOCKWISE == direction) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;for (int j = 0; j &lt; 4; j++) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if (j == i) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; digitalWrite(pins[3 - j], 1); // output a high level <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;} else {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; digitalWrite(pins[3 - j], 0); // output a low level <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; } else if (COUNTER_CLOCKWISE == direction) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;for (int j = 0; j &lt; 4; j++) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if (j == i) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; digitalWrite(pins[j], 1); // output a high level <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;} else {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; digitalWrite(pins[j], 0); // output a low level <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; }<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; delayMS(4);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">}</li></ol></div><em onclick="copycode($('code_Q4l'));" style="border: 0px none rgb(51, 102, 153); color: rgb(51, 102, 153); cursor: pointer; display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18px; font-family: Tahoma, 'Microsoft Yahei', Simsun; margin: 0px 0px 0px 43px; outline: rgb(51, 102, 153) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">复制代码</em></div>编译程序：<br>
Compile the code:<br>
<br>
1<br>
g++ motor.c -o motor -lwiringPi<br>
运行程序：<br>
Run the program:<br>
<br>
1<br>
./motor 0 1 2 3<br>
这里向程序传入了4个参数，它们分别代表要控制的树莓派的GPIO口。切记，由于使用了WiringPi库，所以要参考上面的GPIO分布图的左边那部分来确定这些数字。<br>
The four arguments passed to the program are the GPIO pin numbers on Pi. Be sure to keep in mind that because of using WiringPi, we need to refer to the left part of the GPIO pinouts image describe above to identify the numbers.<br>
<br>
可以看到步进电机已经转动了(如下面的Youku视频所示)。如果你发现转动方向（顺/逆时针）反了，你可以把传入的参数顺序调整一下，就可以让它转对方向。<br>
Then we'll see the stepper motor start to rotate shown as this Youtube video. If you find that the direction of rotation is wrong, just adjust the order of the arguments passed to the program and it will be able to make the direction right.<br>
<br>
从前面的代码可见，如果要改变步进电机的转速，只需要改变rotate()函数中每次delay的时间即可。因此，如果我们把delay的时间逐渐由大变小，就会导致步进电机呈加速状态。让步进电机周期性加速的完整代码如下：<br>
From the code above we know that we can change the rotation speed of the motor by changing the delay time in function rotate(). So if we reduce the delay time gradually, the motor will be in an accelerating state. The full source code to make the motor speeding up periodically is shown below:<div style="background-image: url(http://www.eeboard.com/bbs/static/image/common/codebg.gif); background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(247, 247, 247); background-size: auto; border: 1px solid rgb(204, 204, 204); color: rgb(102, 102, 102); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 21px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 2223px; margin: 10px 0px; outline: rgb(102, 102, 102) none 0px; overflow: hidden; padding: 10px 0px 5px 10px; text-decoration: initial; width: 745px; word-wrap: break-word; background-position: 0px 0px; background-repeat: no-repeat repeat;"><div style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 21px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 2205px; margin: 0px; outline: rgb(102, 102, 102) none 0px; padding: 0px; text-decoration: initial; width: 745px; word-wrap: break-word;"><ol style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 21px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 2205px; margin: 0px 0px 0px 10px; outline: rgb(102, 102, 102) none 0px; padding: 0px; text-decoration: initial; width: 735px; word-wrap: break-word; list-style: decimal outside none;"><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">/* motor_speed_up.c<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">* A program to control a stepper motor(speed up) through the GPIO on Raspberry Pi. <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">* <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">* Author: Darran Zhang (http://www.codelast.com) <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*/<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#include &lt;wiringPi.h&gt;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#include &lt;stdio.h&gt;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#include &lt;unistd.h&gt;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#include &lt;stdlib.h&gt;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#define CLOCKWISE 1<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">#define COUNTER_CLOCKWISE 2<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void delayMS(int x);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void rotate(int* pins, int direction, int delay);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void stop(int* pins);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">int main(int argc,char* argv[]) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;if (argc &lt; 4) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; printf("Usage example: ./motor 0 1 2 3 \n");<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; return 1;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;/* number of the pins which connected to the stepper motor driver board */<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pinA = atoi(argv[1]);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pinB = atoi(argv[2]);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pinC = atoi(argv[3]);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pinD = atoi(argv[4]);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int pins[4] = {pinA, pinB, pinC, pinD};<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;if (-1 == wiringPiSetup()) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; printf("Setup wiringPi failed!");<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; return 1;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;/* set mode to output */<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;pinMode(pinA, OUTPUT);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;pinMode(pinB, OUTPUT);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;pinMode(pinC, OUTPUT);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;pinMode(pinD, OUTPUT);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;delayMS(50);&nbsp; &nbsp; // wait for a stable status <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;int delay = 25;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;while (true) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; for (int i = 0; i &lt; 10; i++) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;rotate(pins, CLOCKWISE, delay);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; }<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; delay--;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; if (delay &lt; 4) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;delay = 25;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;stop(pins);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;delayMS(500);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; }<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;return 0;<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">/* Suspend execution for x milliseconds intervals.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*&nbsp;&nbsp;@param ms Milliseconds to sleep.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*/<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void delayMS(int x) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;usleep(x * 1000);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">/* Rotate the motor.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*&nbsp;&nbsp;@param pins&nbsp; &nbsp;&nbsp;&nbsp;A pointer which points to the pins number array.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 42px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*&nbsp;&nbsp;@param direction&nbsp;&nbsp;CLOCKWISE for clockwise rotation, COUNTER_CLOCKWISE for counter clockwise rotation.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 42px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*&nbsp;&nbsp;@param delay&nbsp; &nbsp; The time intervals(in ms) to delay, and if the value is smaller, the motor rotates faster.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*/<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void rotate(int* pins, int direction, int delay) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;for (int i = 0; i &lt; 4; i++) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; if (CLOCKWISE == direction) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;for (int j = 0; j &lt; 4; j++) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if (j == i) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; digitalWrite(pins[3 - j], 1); // output a high level <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;} else {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; digitalWrite(pins[3 - j], 0); // output a low level <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; } else if (COUNTER_CLOCKWISE == direction) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;for (int j = 0; j &lt; 4; j++) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if (j == i) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; digitalWrite(pins[j], 1); // output a high level <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;} else {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; digitalWrite(pins[j], 0); // output a low level <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp;&nbsp; &nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; }<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; delayMS(delay);<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;"><br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">/* Stop the motor.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*&nbsp;&nbsp;@param pins&nbsp; &nbsp;&nbsp;&nbsp;A pointer which points to the pins number array.<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">*/<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">void stop(int* pins) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;for (int i = 0; i &lt; 4; i++) {<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp; &nbsp; digitalWrite(pins, 0); // output a low level <br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">&nbsp;&nbsp;}<br>
</li><li style="border: 0px none rgb(102, 102, 102); color: rgb(102, 102, 102); display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 21.59375px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; height: 21px; margin: 0px 0px 0px 24px; outline: rgb(102, 102, 102) none 0px; padding: 0px 0px 0px 10px; text-align: left; text-decoration: initial; width: 701px; word-wrap: break-word; list-style: decimal-leading-zero outside none;">}</li></ol></div><em onclick="copycode($('code_Ozh'));" style="border: 0px none rgb(51, 102, 153); color: rgb(51, 102, 153); cursor: pointer; display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18px; font-family: Tahoma, 'Microsoft Yahei', Simsun; margin: 0px 0px 0px 43px; outline: rgb(51, 102, 153) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">复制代码</em></div><i style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: inline; font-style: italic; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 21px; font-family: Tahoma, 'Microsoft Yahei', Simsun; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;"><br>
程序运行效果如下面的视频（Youku，Youtube）所示：<br>
Run the program and then you'll see the speeding up effect, as the video(Youku, Youtube) shown below:<br>
<br>
<br>
</i></td></div><div><a href="thread-5802-1-1.html" style="border: 0px none rgb(51, 51, 51); color: rgb(51, 51, 51); display: inline; font-style: normal; font-variant: normal; font-weight: bold; font-size: 16px; line-height: normal; font-family: 'Microsoft Yahei', Hei, Tahoma, SimHei, sans-serif; outline: rgb(51, 51, 51) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">【分享】通过Raspberry Pi</a></div></body></html>